<%@ page language="java"  pageEncoding="UTF-8"%>
<%@ include file="/views/commons/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>众秀众筹</title>
	<meta name="Keywords" content="众筹，众筹网，众筹导航，众筹门户，股权众筹，众筹平台，众筹圈子人，众筹项目，众筹三方
影视众筹，店铺众筹，餐饮众筹，众筹报告，创业众筹，投后管理，项目融资，项目众筹，权力的游戏，冰与火之歌" />
	<meta name="Description" content="汇集各行业高手分析众筹项目，行业问答，众筹资讯。" />
	<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible" />
	<meta name="renderer" content="webkit"/>
	<link rel="stylesheet" href="<%=path%>/css/bootstrap/3.3.5/css/bootstrap.min.css" />
	<link rel="stylesheet" href="<%=path%>/css/cropper.min.css" />
	<link rel="stylesheet" href="<%=path%>/css/cz.css" />

	<script src="<%=path%>/js/jquery-1.11.0.min.js"></script>
	<script src="<%=path%>/js/plugins/datapicker/bootstrap-datepicker.js"></script>
	<script src="<%=path%>/js/plugins/layer/layer.js"></script>
	<script src="<%=path%>/css/bootstrap/3.3.5/js/bootstrap.min.js"></script>

	<script type="text/javascript" src="<%=path%>/js/slider.js"></script>
	<script type="text/javascript" src="<%=path%>/js/cropper.min.js"></script>
	<script type="text/javascript" src="<%=path%>/js/common.js"></script>
	<script type="text/javascript" src="<%=path %>/js/plugins/ajaxfileupload.js"></script>	
	<script type="text/javascript" src="<%=path %>/js/plugins/CityJson.js"></script>
    <script type="text/javascript" src="<%=path %>/js/plugins/ProJson.js" ></script>
	<script type="text/javascript">
		$(function () {
        	var city_value="${analyze.platformCity}";
        	var province_value="${analyze.platformProvince}";
            $.each(province, function (k, p) { 
                var option = "<option value='" + p.ProID + "' id='" + p.ProName + "'>" + p.ProName + "</option>";
                $("#selProvince").append(option);
            });
             
            $("#selProvince").change(function () {
            	provinceChange();
            });
            
            $("#selCity").change(function () {
            	$("#platform_city").val($(this).find("option:selected").text());
            });
                    
            $("#selProvince option[id='"+province_value+"']").attr("selected",true);
            provinceChange();
            $("#selCity option[id='"+city_value+"']").attr("selected",true);
            $("#platform_city").val($("#selCity").find("option:selected").text());
        });
        
        function provinceChange(){
        	var selValue = $("#selProvince").val();
            $("#selCity option:gt(0)").remove();
            $("#platform_city").val("");
            
            $.each(city, function (k, p) { 
                if (p.ProID == selValue) {
                    var option = "<option value='" + p.CityID + "' id='" + p.CityName + "'>" + p.CityName + "</option>";
                    $("#selCity").append(option);
                }
            });
            
            $("#platform_province").val($("#selProvince").find("option:selected").text());
        }
      </script>
</head>
<body class="gray-bg">
<jsp:include page="/views/commons/header.jsp"></jsp:include>
<div class="container page-single">
	<div class="col-md-12">
		<div class="panel panel-default">
			<div class="panel-heading">
				<h3 class="panel-title">项目编辑</h3>
			</div>
			<div class="panel-body pd_box">
				<form class="form-horizontal" style="padding:40px 80px 40px 0;" id="analyze_form" action="javascript:insertAnalyze()">
					<input type="hidden" name="projectAnalyzeId" value="${analyze.projectAnalyzeId}"/>
					<input type="hidden" name="platformUrl" value="${analyze.platformUrl}">
					<input type="hidden" name="platformType" value="${analyze.platformType}">
					<input type="hidden" name="projectTypeId" value="${analyze.projectTypeId}">					
					
					<div class="form-group">
						<label class="col-sm-2 control-label">项目名<em class="red">*</em></label>
						<div class="col-sm-10">
							<input type="text" class="form-control" placeholder="项目名" name="projectName" value="${analyze.projectName}">
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">所属平台<em class="red">*</em></label>
						<div class="col-sm-10">
							<input type="text" class="form-control" placeholder="上线平台" name="platformName" value="${analyze.platformName}">
						</div>
					</div>
					
					<c:if test="${projectType.needsAddress==1}">
						<div class="form-group" >
							<label class="col-sm-2 control-label">项目所在地</label>
							<div class="col-sm-2">
								<select id="selProvince">
							        <option value="">--请选择省份--</option>
							    </select>
							    <input type="hidden" id="platform_province" name="platformProvince" value="${analyze.platformProvince}">
							</div>
							<div class="col-sm-2">
								<select id="selCity">
							        <option value="">--请选择城市--</option>
							    </select>
							    <input type="hidden" id="platform_city" name="platformCity" value="${analyze.platformCity}">
							</div>
							<div class="col-sm-6">
								<input type="text" class="form-control" name="platformAddress"  value="${analyze.platformAddress}" 
								placeholder="例如：南山区科苑北25号">
							</div>
						</div>
					</c:if>
					
					<div class="form-group">
						<label class="col-sm-2 control-label">调查方式<em class="red">*</em></label>
						<div class="col-sm-10">
							<textarea name="analyzeRemark" rows="3" cols="93">${analyze.analyzeRemark}</textarea>
						</div>
					</div>
					
					<div class="form-group">
						<div class="col-sm-offset-2">
							<div class="text-danger">*以下可以只拆解一部分，可选填</div>
						</div>
					</div>
					<c:forEach var="analyzeItem" items="${analyzeItemList}" varStatus="index">
						<div class="form-group">
							<label for="aa" class="col-sm-2 control-label">分析内容${analyzeItem.itemIndex}</label>
							<div class="col-sm-10">
								<p class="pt5">${analyzeItem.typeDetaiName}</p>
								<textarea name="analyzeDetail_${analyzeItem.itemIndex}" rows="7" class="form-control textmin400" style="min-height: 300px;">${analyzeItem.analyzeDetail}</textarea>
								<div class="row">
									<label  class="radio-inline">别人查看要支付：</label>
									<label class="radio-inline">
										<input type="radio" value="0" id="rechageFee_${analyzeItem.itemIndex}_0" name="rechageFee_${analyzeItem.itemIndex}" 
										<c:if test="${analyzeItem.rechageFee==0}">checked="checked"</c:if>>免费
									</label>
									<c:if test="${isCharge>0}">
										<label class="radio-inline">
											<input type="radio" value="5" id="rechageFee_${analyzeItem.itemIndex}_5" name="rechageFee_${analyzeItem.itemIndex}"
											<c:if test="${analyzeItem.rechageFee==5}">checked="checked"</c:if>>5元
										</label>
										<label class="radio-inline">
											<input type="radio" value="10" id="rechageFee_${analyzeItem.itemIndex}_10" name="rechageFee_${analyzeItem.itemIndex}"
											<c:if test="${analyzeItem.rechageFee==10}">checked="checked"</c:if>>10元
										</label>
										<label class="radio-inline">
											<input type="radio" value="15" id="rechageFee_${analyzeItem.itemIndex}_15" name="rechageFee_${analyzeItem.itemIndex}"
											<c:if test="${analyzeItem.rechageFee==15}">checked="checked"</c:if>>15元
										</label>
									</c:if>
								</div>
							</div>
						</div>
					</c:forEach>
					
					<div class="form-group">
						<div class="col-sm-9 col-sm-offset-2 text-center">
							<button  class="btn btn-primary btn-lg" id="analyze_confirm_btn" >&nbsp;&nbsp;提交&nbsp;&nbsp;</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>

<jsp:include page="/views/commons/footer.jsp"></jsp:include>

<link rel="stylesheet" href="<%=path %>/js/plugins/kindeditor/themes/default/default.css" />
<script charset="utf-8" src="<%=path %>/js/plugins/kindeditor/kindeditor-all.js"></script>
<script charset="utf-8" src="<%=path %>/js/plugins/kindeditor/lang/zh_CN.js"></script>

<script type="text/javascript">
	$(function() {
	var editor;
		KindEditor.ready(function(K) {
			<c:forEach var="analyzeItem" items="${analyzeItemList}" varStatus="index">
			editor = K.create('textarea[name="analyzeDetail_${analyzeItem.itemIndex}"]', {
				allowFileManager: false,
				allowUpload : true,
				uploadJson:"<%=path %>/uncheck/pictures/upload/json",
				items : ['fontname', 'fontsize', '|',
				         'bold','italic', 'underline', 'forecolor','hilitecolor','link','|',
				         'justifyleft', 'justifycenter', 'justifyright','justifyfull','clearhtml', 'quickformat','|',
				         'image', 'table','emoticons','baidumap', '|', 'about'
				 ]
			});
			</c:forEach>
		});
	})
	function insertAnalyze(){
		$("#analyze_confirm_btn").addClass("disabled").attr("disabled","disabled").val("提交中");
		$.ajax({
			url : path + "/check/analyze/update",
			type : "post",
			dataType : "json",
			data : $("#analyze_form").serialize(),
			success : function(data)
			{
				if(data.result){
					layer.msg("发布成功",{icon: 1});;
					window.location.href=path + "/views/analyze/analyze_list.jsp";
				}else{
					layer.msg(data.message,{icon: 2});;
					$("#analyze_confirm_btn").removeClass("disabled").removeAttr("disabled").val("提交");
				}
			},error:function(){
				layer.msg("服务器网络繁忙",{icon: 2});
				$("#analyze_confirm_btn").removeClass("disabled").removeAttr("disabled").val("提交");
			}
		});
	}
</script>
</body>
</html>